home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_08_11 / 8n11088c < prev    next >
Text File  |  1990-09-16  |  561b  |  24 lines

  1.     
  2. class List {
  3. public:
  4.      List()              { head = 0; }
  5.      ~List()             {}
  6.      Truth isempty()     { return head == 0; }
  7.      T get()             { return head->value(); }
  8.      void add(T x)     { /* as before */ }
  9.      T del()          { /* as before */ }
  10. private:
  11.      Node *head;
  12.   
  13.      friend It;         // It is still a friend of List
  14.      // tail returns the tail of the List.  cdr in LISP.
  15.      List tail()
  16.      {
  17.           List r;
  18.           if( !isempty() )
  19.                r.head = head->next();
  20.           return r;
  21.      }
  22. };
  23.  
  24.